<?php
my_component_load('testing' , false);
my_component_load('paging' , false);
my_component_load('jurnal_gaji');
my_component_load('data_setting', false);
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id= isset( $_GET['id'] ) ? $_GET['id']:  0;
$facebox=true ; 
$modulname = "Admin _BN_ Konfigurasi Data";

if($_SERVER['REQUEST_METHOD'] == "POST" ):
    $validatepost = form_jurnal_gaji_validate($id);
	if($validatepost){
		$content = message_multi_error($validatepost);
		$content .= form_jurnal_gaji_create($id);
		if($facebox){
			generate_my_web($content,"","plain.php");
			exit; 
		}else{
			$pagename = "Jurnal Gaji";
			generate_my_web($content, $pagename  );		
		}	
		
	}else{
		form_jurnal_gaji_submit($id);
		if($facebox){
			$content =  "Updated";
			generate_my_web($content,"","plain.php");
			exit;
		}	
	}
	my_direct('index.php?com=jurnal_gaji');
	break;
else: 
	if($task == 'page'){
		$content  = form_jurnal_gaji_create($id);
		generate_my_web($content,"","plain.php");
		exit; 	
	}elseif($task =='edit'){
		$pagename= ($id > '0' ) ?  "Perubahan Data Jurnal Gaji" : "Tambah Data Jurnal Gaji";
		
		if($facebox){
			facebox_page('index.php?com=jurnal_gaji&task=page&id='.$id , $pagename , 210	); 			
		}else{				
			$content  = form_jurnal_gaji_create($id);
			generate_my_web($content, $pagename  );	
		}
	}elseif($task =='delete'){
		 delete_jurnal_gaji($id);
		 my_direct($_SERVER['HTTP_REFERER']);
	}else{
		$pagename = "Jurnal Gaji";
		load_facebox_script();	
		$view = list_jurnal_gaji();
		$href = 'index.php?com=jurnal_gaji&task=edit' ;
	}
endif;  
$content = spliter_browser( $view , $pagename ,$href);
generate_my_web($content, $modulname." _BN_ Jurnal Gaji" );

?>
